package cn.tellsea;

import cn.tellsea.service.EchoService;
import org.apache.dubbo.config.annotation.Reference;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

/**
 * spring cloud dubbo 消费者
 *
 * @author Tellsea
 * @date 2021/12/20
 */
@EnableDiscoveryClient
@RestController
@SpringBootApplication
public class SpringCloudAlibabaDubboConsumerApplication {

    @Reference
    private EchoService echoService;

    @GetMapping("/echo/{message}")
    public String echo(@PathVariable("message") String message) {
        return echoService.echo(message);
    }

    public static void main(String[] args) {
        SpringApplication.run(SpringCloudAlibabaDubboConsumerApplication.class, args);
    }

}
